"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_news_index = require("../../../api/news/index.js");
const config_app = require("../../../config/app.js");
if (!Array) {
  const _easycom_up_divider2 = common_vendor.resolveComponent("up-divider");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_divider2 + _easycom_up_toast2)();
}
const _easycom_up_divider = () => "../../../node-modules/uview-plus/components/u-divider/u-divider.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_divider + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "detail",
  setup(__props) {
    const uToastRef = common_vendor.ref(null);
    const request = common_vendor.ref([api_news_index.detailAntiFraud, api_news_index.detailFireSafety, api_news_index.detailPreventiveTip, api_news_index.regulationsselectOne]);
    const deatilInfo = common_vendor.ref({});
    common_vendor.onLoad((options) => {
      if (options) {
        initNewsDetail(options.newsId, options.newsType);
      }
    });
    const initNewsDetail = (id, type) => {
      common_vendor.index.showLoading({
        title: "加载中",
        mask: true
      });
      request.value[type]({ id, type: "crowd" }).then((res) => {
        common_vendor.index.hideLoading();
        const { data } = res;
        deatilInfo.value = data;
      }).catch((err) => {
        common_vendor.index.hideLoading();
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(common_vendor.unref(deatilInfo).title),
        b: common_vendor.t(common_vendor.unref(deatilInfo).createTime ? common_vendor.unref(common_vendor.dayjs)(common_vendor.unref(deatilInfo).createTime).format("YYYY-MM-DD hh:mm:ss") : ""),
        c: common_vendor.p({
          lineColor: "#BBBBBB"
        }),
        d: common_vendor.unref(deatilInfo).videoUrl
      }, common_vendor.unref(deatilInfo).videoUrl ? {
        e: common_vendor.unref(config_app.imgPrefix) + common_vendor.unref(deatilInfo).videoUrl
      } : {}, {
        f: common_vendor.unref(deatilInfo).content,
        g: common_vendor.sr(uToastRef, "6f06568e-1", {
          "k": "uToastRef"
        })
      });
    };
  }
});
wx.createPage(_sfc_main);
